<?php
/**
 * Created by PhpStorm.
 * User: chenxiaogang
 * Date: 2018/1/4
 * Time: 15:09
 */

namespace User\Model;


use Common\Model\CommonModel;

/**
 * Class LoanReceivedLogModel
 * @package     User\Model
 * @description 贷后操作收款记录表
 * @end
 */
class LoanReceivedLogModel extends CommonModel
{
    /**
     * @var string MySQL连接实例
     */
    protected $connection = 'DB_CONFIG2';
    /**
     * @var string 真实表全名
     */
    protected $trueTableName = 'system_loan_received_log';

    /**
     * @use          [获取支付方式标识]
     * @author       chenxiaogang
     * @param $key
     * @return mixed|string
     */
    public static function getPayWayText($key)
    {
        $payWayList = [
            0=>'系统',
            1=>'微信',
            2=>'支付宝',
            3=>'银行转账'
        ];
        if(array_key_exists($key,$payWayList)){
            return $payWayList[$key];
        }else{
            return '';
        }
    }

    /**
     * @use          [获取微信收款人列表]
     * @author       chenxiaogang
     * @return array|mixed
     */
    public static function getWechatRevAdminList()
    {
        //所有“贷后”和财务（东平、知林）、老板微信
        $daihouList = (new RoleUser())->getDaiHouList();
        $caiwuList = (new User())->getListByIn( '19,21' );//19黄东平、21上官知林
        $laoban = [ [ 'id' => 1, 'user_login' => '上官志勇(老板)' ] ];
        $arr = array_merge($daihouList,$caiwuList,$laoban);
        return $arr;
    }

    /**
     * @use          [获取支付宝收款人列表]
     * @author       chenxiaogang
     * @return mixed
     */
    public static function getAlipayRevAdminList()
    {
        //东平、知林
        $caiwuList = (new User())->getListByIn( '19,21' );//19黄东平、21上官知林
        return $caiwuList;
    }

    /**
     * @use          [获取银行转账人列表]
     * @author       chenxiaogang
     * @return array
     */
    public static function getBankTransferAdminList()
    {
        //老板
        $laoban = [ [ 'id' => 1, 'user_login' => '上官志勇(老板)' ] ];
        return $laoban;
    }

    /**
     * @use          [获取所有收款人]
     * @author       chenxiaogang
     * @return array
     */
    public function getAllRevAdmin()
    {
        $arr0 = [[ 'id' => 0, 'user_login' => '系统' ] ];
        $arr1 = self::getWechatRevAdminList();
        $arr2 = self::getAlipayRevAdminList();
        $arr3 = self::getBankTransferAdminList();
        $arr = array_merge($arr0,$arr1,$arr2,$arr3);
        return $arr;
    }

}